/*
 ============================================================================
 Name        : NetClient.c
 Author      : 
 Version     :
 Copyright   : Your copyright notice
 Description : Hello World in C, Ansi-style
 ============================================================================
 */

#include <stdio.h>
#include <stdlib.h>
#include "rio.h"

int main(void) {
	int clientfd, port;
	char buf[MAXLINE];
	rio_t rio;

	//*host = "localhost";
	port = 8088;

	clientfd = Open_clientfd("localhost", port);
	Rio_readinitb(&rio, clientfd);

	while (fgets(buf, MAXLINE, stdin) != NULL) {
		Rio_writen(clientfd, buf, strlen(buf));
		Rio_readlineb(&rio, buf, MAXLINE);
		fputs(buf, stdout);
		break;
	}

	//close(clientfd);
	exit(0);
}
